package nc.ui.zujin.cqcm;

import nc.bs.logging.Logger;
import nc.ui.pub.ClientEnvironment;
import nc.ui.trade.business.HYPubBO_Client;
import nc.ui.trade.pub.IVOTreeDataByID;
import nc.vo.pub.SuperVO;
import nc.vo.scm.pu.PuPubVO;
import nc.vo.zujin.cqcm.CqcmVO;

public class ClientTreeCardData implements IVOTreeDataByID {

	public SuperVO[] classvo = null;

	public String getShowFieldName() {
		return "codename";
	}

	public SuperVO[] getTreeVO() {
		if (classvo == null) {
			try {
				classvo = (SuperVO[]) HYPubBO_Client.queryByCondition(
						CqcmVO.class, " isnull(dr,0) = 0 and pk_corp = '"
								+ ClientEnvironment.getInstance().getCorporation().getPrimaryKey() + "' order by vcode ");
			} catch (Exception e) {
				Logger.error(e);
			}
		}
		for (SuperVO vo : classvo) {
			vo.setAttributeValue("codename", PuPubVO
					.getString_TrimZeroLenAsNull(vo.getAttributeValue("vcode"))
					+ " " + PuPubVO.getString_TrimZeroLenAsNull(vo.getAttributeValue("vname")));
		}
		return classvo;
	}

	public String getIDFieldName() {
		return "pk_cqcm";
	}

	public String getParentIDFieldName() {
		return "pk_parent";
	}
}
